import service from "@/utils/request";

//登录请求
export const loginApi = (data) => {
  return service({
    url: "/frame/login",
    method: "post",
    data,
  });
};

//获取用户资料
export const getUserProfileApi = () => {
  return service({
    url: "/frame/profile",
    method: "post",
  });
};
//获取用户列表
export const getUserListApi = (params) => {
  return service({
    url: "/users",
    method: "get",
    params,
  });
};

// 用户删除
export const delUserApi = (id) => {
  return service({
    url: "/users/" + id,
    method: "delete",
  });
};

// 用户添加
export const addUserApi = (data) => {
  return service({
    url: "/users",
    method: "post",
    data,
  });
};

// 用户编辑
export const editUserApi = (data) => {
  return service({
    url: "/users/" + data.id,
    method: "PUT",
    data,
  });
};

// 获取单个用户
export const getUserInfoApi = (id) => {
  return service({
    url: "/users/" + id,
    method: "get",
  });
};
